#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

void* MyThreadStart(void* arg)
{
    (void)arg;
    while(1)
    {
        printf("i am MyThreadStart\n");
        pthread_cancel(pthread_self());
        sleep(1);
    }
    return NULL;
} 
int main()
{
    pthread_t tid;
    int ret = pthread_create(&tid,NULL,MyThreadStart,NULL);
    if( ret!=0 )
    {
        perror("pthread_create");
        return 0;
    }
    pthread_join(tid,NULL);
    while(1)
    {
        printf("i am main thread\n");
        sleep(1);   
    }
    return 0;
}
